package cnhy.salary.domain;

import cnhy.salary.domain.proxy.DepartmentProxy;
import com.easy.query.core.annotation.*;
import com.easy.query.core.enums.RelationTypeEnum;
import com.easy.query.core.proxy.ProxyEntityAvailable;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.ruoyi.common.core.domain.entity.SysDept;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import ling.common.domain.entity.CU2Entity;
import ling.common.domain.entity.IdEntity;
import lombok.Data;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

@ApiModel(value = "班组部门管理",description = "")
@EntityProxy
@Table(value = "sys_dept",ignoreProperties = {"id"})
@Data
public class Department extends SysDept  implements IdEntity<Long>, ProxyEntityAvailable<Department , DepartmentProxy> {


    /** 搜索值 */
    @JsonIgnore
    @ColumnIgnore
    private String searchValue;

    /** 备注 */
    @ColumnIgnore
    private String remark;

    /** 请求参数 */
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    @ColumnIgnore
    private Map<String, Object> params;
    /** 部门ID */
    @EasyWhereCondition(type = EasyWhereCondition.Condition.EQUAL)
    @Column(primaryKey = true,generatedKey = true)
    private Long deptId;

    /** 父部门ID */
    private Long parentId;

    @Navigate(value = RelationTypeEnum.OneToMany, selfProperty = {"deptId"}, targetProperty = {"parentId"})
    List<Department> childList;
    /** 祖级列表 */
    private String ancestors;

    /** 部门名称 */
    @EasyWhereCondition
    private String deptName;

    /** 显示顺序 */
    private Integer orderNum;

    /** 负责人 */
    private String leader;

    /** 联系电话 */
    private String phone;

    /** 邮箱 */
    private String email;

    /** 部门状态:0正常,1停用 */
    private String status;

    /** 删除标志（0代表存在 2代表删除） */
    private String delFlag;


    /** 父部门名称 */
    @ColumnIgnore
    private String parentName;

    /** 子部门 */
    @ColumnIgnore
    private List<SysDept> children = new ArrayList<SysDept>();

    /** 创建者 */
    private String createBy;

    /** 创建时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /** 更新者 */
    private String updateBy;

    /** 更新时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    /** 类型：10000系统内置生产部
     *
     */
    @ApiModelProperty(value = "类型：10000系统内置生产部根，其他值忽略")
    Integer type;

    @ApiModelProperty(value = "领导的userId")
    Long leaderId;

    @ApiModelProperty(value = "所属产线id")
    @EasyWhereCondition(type = EasyWhereCondition.Condition.EQUAL)
    Long lineId;
    @ApiModelProperty(value = "产线名称")
    String lineName;
    @Override
    public Long getId() {
        return getDeptId();
    }

    @Override
    public void setId(Long id) {
        setDeptId(id);
    }
}
